From be9a0806e197f4fd3fa64d6535e74e16d4338a83 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 14 Apr 2010 12:03:27 +0100 Subject: [PATCH] credit2: Add context_saved scheduler callback Because credit2 shares a runqueue between several cpus, it needs to know when a scheduled-out process has finally been context-switched away so that it can be added to the runqueue again. (Otherwise it may be grabbed by another processor before the context has been properly saved.) Signed-off-by: George Dunlap --- xen/common/schedule.c | 2 ++ xen/include/xen/sched-if.h | 1 + 2 files changed, 3 insertions(+) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 5b28004cc6..45d3040728 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -885,6 +885,8 @@ void context_saved(struct vcpu *prev) /* Check for migration request /after/ clearing running flag. */ smp_mb(); + SCHED_OP(context_saved, prev); + if ( unlikely(test_bit(_VPF_migrating, &prev->pause_flags)) ) vcpu_migrate(prev); } diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index ed05757730..352e43f5ef 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -70,6 +70,7 @@ struct scheduler { void (*sleep) (struct vcpu *); void (*wake) (struct vcpu *); + void (*context_saved) (struct vcpu *); struct task_slice (*do_schedule) (s_time_t); -- 2.30.2